When the last interesting window of an app-backed window is removed,
we'll transition it back to STOPPED, but we transition the state and
send out the signal before we clear the running state.
This means that any listeners to the state-changed signal might
encounter a window-backed app that has a running state, but no
windows. If they call, e.g. shell_app_get_name, while in this state,
they'll encounter an assertion fail.
if (!meta_window_is_skip_taskbar (window))
app->running_state->interesting_windows--;
- shell_app_sync_running_state (app);
- if (app->running_state && app->running_state->windows == NULL)
- g_clear_pointer (&app->running_state, unref_running_state);
+ if (app->running_state->windows == NULL)
+ {
+ g_clear_pointer (&app->running_state, unref_running_state);
+ shell_app_state_transition (app, SHELL_APP_STATE_STOPPED);
+ }
+ else
+ {
+ shell_app_sync_running_state (app);
+ }
g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0);
}